<?php


namespace app\api\controller;

//use http\Env;
use app\api\controller\IpConfig;
use think\facade\Config;
use think\facade\Env;
use think\Request;

class Imagecommon extends Base
{


    public function uploadimg(Request $request){
        $t=new IpConfig();
        $file = request()->file('file');
        //$content =
        // 移动到框架应用根目录/uploads/ 目录下
        $info = $file->move( '../uploads');
        if($info){
            $path = $t->index() ."/php_big_project/api/".'uploads/' . $info->getSaveName();
            return json(['code' => 1, 'msg' => '上传成功', 'url' => $path]);
        }else{
            // 上传失败获取错误信息
            return json(['code' => 0, 'msg' => $file->getError()]);
        }
    }

}